<?php
header("Content-type:text/html; charset=utf-8;");
require '../../../ppf/fun.php';
require '../../../ppf/pdo_mysql.php';
require '../../../ppf/Filter.php';
date_default_timezone_set("PRC");
$pd=new pdo_mysql();
$filter=new Filter();
session_start();
if(empty($_SESSION['uid'])){
	echo '请登录后再进行操作';exit;
}
$submitMethod=$_SERVER["REQUEST_METHOD"];
if($submitMethod=='POST'){
    $id      = empty($_POST['id'])?"":$_POST['id'];
	$name =  empty($_POST['name'])?"":$_POST['name'];
	$odx =  empty($_POST['odx'])?0:$_POST['odx'];
	if(!$id){
		$in_data=array(
			'name' =>$name,
			'odx'  =>$odx,
	    );
		$rs = $pd->insert(array('data'=>$in_data,'table'=>'sys_schedule_type'));
		if($rs){
			$tips='新建事务类型成功';
		}else{
			$tips='新建事务类型失败，请重试';
		}
		echo $tips;exit;
	}else{
		$up_data=array(
			'name'    =>$name,
			'odx'       =>$odx,
	    );
	    $rg=$pd->update(array('data'=>$up_data,'table'=>'sys_schedule_type','where'=>"id=".$id));
	    if($rg===false){
	    	$tips='更新事务类型失败，请重试';	
		}else{
			$tips='更新事务类型成功';
		}
		echo $tips;exit;
	}
}else{
	echo '不允许的表单提交方式，请按正常流程提交表单。';exit;
}
?>